#ifndef RECORD_H
#define RECORD_H

#include <alsa/asoundlib.h>

// 错误码定义
#define ERROR_PCM_OPEN_FAILED -1
#define ERROR_HW_PARAMS_FAILED -2
#define ERROR_PCM_WRITE_FAILED -3

// 打开并配置PCM设备
int open_pcm_device(snd_pcm_t **capture, const char *device, snd_pcm_format_t format, unsigned int rate, int channels, snd_pcm_uframes_t frames);

// 开始录音
int start_recording(const char *filename, snd_pcm_uframes_t frames, int channels);

// 停止录音
void stop_recording();

// 录音处理函数
void handle_recording(snd_pcm_uframes_t frames);

#endif // RECORD_H
